package com.bp.system.domain;

import com.bp.common.annotation.Excel;
import com.bp.common.annotation.Excels;
import com.bp.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;

/**
 * 部门表 sys_dept
 * 
 * @author shaominjie
 */
public class SysDept extends BaseEntity {
    private static final long serialVersionUID = 1L;


    private Long regionId;

    @Excels( @Excel)
    private SysRegion region;

    /** 部门ID */
    @Excel(name = "部门ID", cellType = Excel.ColumnType.NUMERIC, prompt = "部门ID")
    private Long deptId;

    /** 父部门ID */
    @Excel(name = "父部门ID", cellType = Excel.ColumnType.NUMERIC, prompt = "父部门ID")
    private Long parentId;

    /** 部门ID */
    @Excel(name = "部门编号", cellType = Excel.ColumnType.STRING, prompt = "部门编号")
    @Size(max = 64, message = "部门名称长度不能超过64个字符")
    private String deptCode;

    /** 部门类型 */
    @Excel(name = "部门类型", cellType = Excel.ColumnType.NUMERIC, prompt = "部门类型",
            readConverterExp = "1=公司,2=部门,3=组,4=其他")
    private Integer deptType;

    /** 部门属性 */
    @Excel(name = "部门属性", cellType = Excel.ColumnType.NUMERIC, prompt = "部门属性")
    private Integer property;

    /** 祖级列表 */
    @Excel(name = "祖级列表", cellType = Excel.ColumnType.STRING, prompt = "部门路径")
    private String ancestors;

    /** 部门名称 */
    @Excel(name = "部门名称", cellType = Excel.ColumnType.STRING, prompt = "部门名称")
    @NotBlank(message = "部门名称不能为空")
    @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
    private String deptName;

    /** 显示顺序 */
    @Excel(name = "显示顺序", cellType = Excel.ColumnType.STRING, prompt = "显示顺序")
    @NotBlank(message = "显示顺序不能为空")
    private String orderNum;

    /** 负责人 */
    @Excel(name = "负责人", cellType = Excel.ColumnType.STRING, prompt = "负责人")
    private String leader;

    /** 联系电话 */
    @Excel(name = "联系电话", cellType = Excel.ColumnType.STRING, prompt = "联系电话")
    @Size(max = 11, message = "联系电话长度不能超过11个字符")
    private String phone;

    /** 邮箱 */
    @Excel(name = "邮箱", cellType = Excel.ColumnType.STRING, prompt = "邮箱")
    @Email(message = "邮箱格式不正确")
    @Size(max = 50, message = "邮箱长度不能超过50个字符")
    private String email;

    /** 邮箱 */
    @Excel(name = "地址", cellType = Excel.ColumnType.STRING, prompt = "地址")
    @Size(max = 64, message = "地址长度不能超过64个字符")
    private String address;

    /** 部门状态:0正常,1停用 */
    @Excel(name = "部门状态", cellType = Excel.ColumnType.NUMERIC, prompt = "部门状态:0正常,1停用",readConverterExp = "0=正常,1=停用,2=删除")
    private Integer status;

    /** 父部门名称 */
    @Excel(name = "父部门名称", cellType = Excel.ColumnType.STRING, prompt = "父部门名称")
    private String parentName;

    /** 父部门名称 */
    private String icon;

    /** 子部门 */
    private List<SysDept> children = new ArrayList<SysDept>();

    public SysDept() {
    }


    //<editor-fold desc="GET/SET">


    public List<SysDept> getChildren() {
        return children;
    }

    public void setChildren(List<SysDept> children) {
        this.children = children;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Long getRegionId() {
        return regionId;
    }

    public void setRegionId(Long regionId) {
        this.regionId = regionId;
    }

    public SysRegion getRegion() {
        return region;
    }

    public void setRegion(SysRegion region) {
        this.region = region;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    public Integer getDeptType() {
        return deptType;
    }

    public void setDeptType(Integer deptType) {
        this.deptType = deptType;
    }

    public Integer getProperty() {
        return property;
    }

    public void setProperty(Integer property) {
        this.property = property;
    }

    public String getAncestors() {
        return ancestors;
    }

    public void setAncestors(String ancestors) {
        this.ancestors = ancestors;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public String getLeader() {
        return leader;
    }

    public void setLeader(String leader) {
        this.leader = leader;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
    //</editor-fold>

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("deptId", getDeptId())
            .append("parentId", getParentId())
            .append("ancestors", getAncestors())
            .append("deptName", getDeptName())
            .append("orderNum", getOrderNum())
            .append("leader", getLeader())
            .append("phone", getPhone())
            .append("email", getEmail())
            .append("status", getStatus())
            .append("delFlag", getDelFlag())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
